//
//  UIView+Frame.m
//  SinaWeibo-OC
//
//  Created by apple on 15/11/28.
//  Copyright © 2015年 apple. All rights reserved.
//

#import "UIView+Frame.h"
/**
 *  创建一个快速计算frame 的分类
 */
@implementation UIView (Frame)

- (void)setX:(CGFloat)x {
    
    CGRect tempFrame = self.frame;
    
    tempFrame.origin.x = x;
    
    self.frame = tempFrame;
}
- (CGFloat)x {
    
    return self.frame.origin.x;
}

- (void)setY:(CGFloat)y {
    
    CGRect tempFrame = self.frame;
    
    tempFrame.origin.y = y;
    
    self.frame = tempFrame;

}

- (CGFloat)y{
    
    return self.frame.origin.y;
}
- (void)setWidth:(CGFloat)width {
    
    
    CGRect tempFrame = self.frame;
    
    tempFrame.size.width = width;
    
    self.frame = tempFrame;
    

}
- (CGFloat)width {
    
    return self.frame.size.width;
}
- (void)setHeight:(CGFloat)height {
    
    CGRect tempFrame = self.frame;
    
    tempFrame.size.height = height;
    
    self.frame = tempFrame;
    

}
- (CGFloat)height {
    
    return  self.frame.size.height;
}
- (void)setCenterX:(CGFloat)centerX {
    
    
    CGPoint tempCenter = self.center;
    
    tempCenter.x = centerX;
    
    self.center = tempCenter;
    

}
- (CGFloat)centerX{
    
    return self.center.x;
}
- (void)setCenterY:(CGFloat)centerY {
    
    
    CGPoint tempCenter = self.center;
    
    tempCenter.y = centerY;
    
    self.center = tempCenter;
}
- (CGFloat)centerY {
    
    return  self.center.y;
}

- (void)setSize:(CGSize)size {
    
    CGRect temoFrame = self.frame;
    
    temoFrame.size = size;
    
    self.frame = temoFrame;
}
- (CGSize)size
{
    return self.frame.size;
}

@end
